!function(t,e,a){var i=function(e){"use strict";return this.ga=e,null!=this.ga&&this.ga("require","ec"),t.EnhancedEcommerceLoaded=!0,this};i.prototype.extend=function(){for(var t=1;t-1&&200===e.status){var o=/[\?&]product_id=([^&]*)/g,r=o.exec(a.url);if(r&&r[1]&&i.addToBasketData[parseInt(r[1])]){var s=parseInt(r[1]);(r=(o=/[\?&]quantity=([^&]*)/g).exec(a.url))&&r[1]&&void 0!==i.addToBasketData[s].ecommerce&&void 0!==i.addToBasketData[s].ecommerce.add&&void 0===i.addToBasketData[s].ecommerce.add.products[0].quantity&&(i.addToBasketData[s].ecommerce.add.products[0].quantity=parseInt(r[1])),i.vsDataLayer=i.addToBasketData[s],i.prototype.pushDataLayer()}$(t.currentTarget).unbind("ajaxComplete")}a.url.indexOf("/ajax/dynamic_bundles_addtobasket/")>-1&&200===e.status&&void 0!==e.responseJSON&&void 0!==e.responseJSON.products&&$.each(e.responseJSON.products,function(t,o){if(void 0!==e.responseJSON.products[t].product_id&&void 0!==i.addToBasketData[e.responseJSON.products[t].product_id]){var r=/[\?&]overall_qty=([^&]*)/g.exec(a.url),s=e.responseJSON.products[t].product_id;return r&&r[1]&&void 0!==i.addToBasketData[s].ecommerce&&void 0!==i.addToBasketData[s].ecommerce.add&&void 0===i.addToBasketData[s].ecommerce.add.products[0].quantity&&(i.addToBasketData[s].ecommerce.add.products[0].quantity=parseInt(r[1])),i.vsDataLayer=i.addToBasketData[s],i.prototype.pushDataLayer(),!1}})})}else"remove"==r.eventAction?(s.vsDataLayer={event:i.ActionTagManager.REMOVE,eventCallback:r.hitCallback,ecommerce:{remove:{actionField:s.extend({},o),products:[s.extend({},t)]}}},s.pushDataLayer()):"checkout"==r.eventAction?(s.vsDataLayer={event:i.ActionTagManager.CHECKOUT,eventCallback:r.hitCallback,ecommerce:{checkout:{actionField:s.extend({},o),products:[s.extend({},t)]}}},s.pushDataLayer()):"checkout_option"==r.eventAction&&(s.vsDataLayer={event:i.ActionTagManager.CHECKOUT_OPTION,eventCallback:r.hitCallback,ecommerce:{checkout_option:{actionField:s.extend({},o)}}},s.pushDataLayer())};if(null===a)c();else{var n=e.querySelectorAll(a);for(var d in n)if(void 0!==n.hasOwnProperty&&n.hasOwnProperty(d)&&n[d].addEventListener){n[d].addEventListener("click",c,!0)}}},i.prototype.bindProductClick=function(t,e,a,i){"use strict";this.bindClickAction(t,e,a,i)},i.prototype.bindProductAdd=function(t,e,a,i){"use strict";this.bindClickAction(t,e,a,i)},i.prototype.bindProductRemove=function(t,e,a,i){"use strict";this.bindClickAction(t,e,a,i)},i.prototype.bindShippingClick=function(t,e,a){"use strict";this.bindClickAction({},t,e,a)},i.prototype.addImpression=function(t){"use strict";this.impressions=this.impressions||[],null!=this.ga?this.ga("ec:addImpression",t):(this.impressions.push(this.extend({},t)),this.vsDataLayer={ecommerce:{impressions:this.impressions}},this.pushDataLayer())},i.prototype.addProduct=function(t){"use strict";this.products=this.products||[],null!=this.ga?this.ga("ec:addProduct",t):this.products.push(this.extend({},t))},i.prototype.setAction=function(t,e){"use strict";e=e||{},null!=this.ga?(this.ga("ec:setAction",t,e),t==i.Action.CHECKOUT?self.ga("send","event","Checkout"):t==i.Action.CHECKOUT_OPTION&&self.ga("send","event","Checkout","Option")):"detail"==t?(this.vsDataLayer={ecommerce:{detail:{actionField:this.extend({},e),products:this.products}}},this.pushDataLayer()):"purchase"==t?(this.vsDataLayer={event:i.ActionTagManager.PURCHASE,ecommerce:{purchase:{actionField:this.extend({},e),products:this.products}}},this.pushDataLayer()):"checkout"==t?(this.vsDataLayer={event:i.ActionTagManager.CHECKOUT,ecommerce:{checkout:{actionField:this.extend({},e),products:this.products}}},this.pushDataLayer()):"checkout_option"==t&&(this.vsDataLayer={event:i.ActionTagManager.CHECKOUT_OPTION,ecommerce:{checkout_option:{actionField:this.extend({},e)}}},this.pushDataLayer())},i.prototype.bindPromoClick=function(t,a,o){"use strict";var r=this;t=t||{},o=o||{};var s=function(e){var a=o.hitCallback;(e.shiftKey||e.ctrlKey||e.metaKey)&&(a=function(){}),r.vsDataLayer=r.vsDataLayer||{},t!=={}&&r.addPromo(t),r.setAction(o.eventAction),null!=r.ga?r.ga("send","event",o):(r.vsDataLayer={event:i.ActionTagManager.PROMO_CLICK,eventCallback:a,ecommerce:{promoClick:{promotions:[r.extend({},t)]}}},r.pushDataLayer())},c=e.querySelectorAll(a);for(var n in c)if(c.hasOwnProperty(n)&&c[n].addEventListener){c[n].addEventListener("click",s,!0)}},i.prototype.addPromo=function(t){"use strict";this.promos=this.promos||[],null!=this.ga?this.ga("ec:addPromo",t):(this.promos.push(this.extend({},t)),this.vsDataLayer={ecommerce:{promoView:{promotions:this.promos}}},this.pushDataLayer())},i.prototype.pushDataLayer=function(){"use strict";null==this.ga&&dataLayer.push(this.vsDataLayer||i.vsDataLayer)},i.prototype.applyCustomMetrics=function(t,e){"use strict";for(var a in e)void 0===t[a]&&null!==a.match("^(dimension|metric)[0-9]{1,2}$")&&(t[a]=e[a])},t.EnhancedEcommerce=i,i.vsDataLayer={},i.Action={CLICK:"click",DETAIL:"detail",ADD:"add",REMOVE:"remove",CHECKOUT:"checkout",CHECKOUT_OPTION:"checkout_option",PURCHASE:"purchase",REFUND:"refund",PROMO_CLICK:"promo_click"},i.ActionTagManager={CLICK:"productClick",ADD:"addToCart",REMOVE:"removeFromCart",CHECKOUT:"checkout",CHECKOUT_OPTION:"checkoutOption",PROMO_CLICK:"promotionClick",PURCHASE:"purchase"},i.ActionFieldObject=function(t){"use strict";var e={id:a,affiliation:a,revenue:a,tax:a,shipping:a,coupon:a,list:a,customerEmail:a,step:a,option:a};for(var o in e)e.hasOwnProperty(o)&&(this[o]=t[o]||e[o]);return i.prototype.applyCustomMetrics(this,t),this},i.ImpressionFieldObject=function(t){"use strict";var e={id:a,childId:a,childIds:a,name:a,category:a,brand:a,variant:a,list:a,position:a,price:a,sku:a};for(var o in e)e.hasOwnProperty(o)&&(this[o]=t[o]||e[o]);return i.prototype.applyCustomMetrics(this,t),this},i.ProductFieldObject=function(t){"use strict";var e={id:a,childId:a,childIds:a,name:a,category:a,brand:a,variant:a,position:a,price:a,quantity:a,coupon:a,sku:a};for(var o in e)e.hasOwnProperty(o)&&(this[o]=t[o]||e[o]);return i.prototype.applyCustomMetrics(this,t),this},i.PromoFieldObject=function(t){"use strict";var e={id:a,name:a,creative:a,position:a};for(var o in e)e.hasOwnProperty(o)&&(this[o]=t[o]||e[o]);return i.prototype.applyCustomMetrics(this,t),this}}(window,document);